package com.cet.lxf.reflection.test03;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * @program: algorithm
 * @description:
 * @author: 陈恩涛
 * @create: 2021-07-29 10:46
 **/
public class Main01 {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, NoSuchFieldException {
        String s = "Hello world!";
        Class<? extends String> cls = s.getClass();
        Method m = cls.getMethod("substring", int.class);
        String value = (String) m.invoke(s, 3);
        System.out.println(value);
    }
}
